home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-09-19 | 1.4 KB | 41 lines | [TEXT/ToyS] |
- -- this is a simple script to compare the performance of the Trim
- -- Scripting Addition against performing the same operation with pure AppleScript
- -- statements. It requires the Scripting Addition "the ticks" from Jon Pugh's
- -- collection of osaxen called "Jon's Commands"
-
- set theTimes to {}
-
- -- set up test string
- set theString to ".......On a clear day you can see forever "
-
- set stTicks to the ticks -- record ticks before beginning
-
- set currentChar to length of theString -- strip space/. from end of string
- repeat while ((character currentChar of theString = " ") or ¬
- (character currentChar of theString = " ")) ¬
- and (currentChar > 0)
- set currentChar to (currentChar - 1)
- end repeat
- set theString to characters 1 thru currentChar of theString as text
-
- set currentChar to 1 -- strip space/. from start of string
- repeat while ((character currentChar of theString = ".") or ¬
- (character currentChar of theString = ".")) ¬
- and (currentChar < length of theString)
-
- set currentChar to (currentChar + 1)
- end repeat
- set theString to characters currentChar thru -1 of theString as text
-
- set theTimes to theTimes & ((the ticks) - stTicks) -- save ending ticks
-
- -- reset test string
- set theString to ".......On a clear day you can see forever "
- set stTicks to the ticks -- get starting ticks
- set theString to trim {".", " "} off theString from both sides
-
- set theTimes to theTimes & ((the ticks) - stTicks) -- get ending ticks and return times
-
-
- return theTimes
-